﻿     
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>iBOS/e eForum Manager</title>


<script type="text/javascript" src="eforum.js">
</script>

<script type="text/javascript" src="../../scripts/tinymce/jscripts/tiny_mce/tiny_mce.js"> 
</script>


<style>
.ui-autocomplete-loading {
	background: white url('http://jqueryui.com/resources/demos/autocomplete/images/ui-anim_basic_16x16.gif') right center no-repeat;
}
</style>

</head>

<body>

<cfquery name="getFolderName" datasource="#client.company_dsn#">
    
    SELECT FOLDERCODE,
    	   DESCRIPTION,
           USERID,
           FOLDERTYPE,
           TEMPLATECODE_FK
           
     FROM ECRGCOLLAB
    WHERE USERID = '#client.USERID#'
    ORDER BY DESCRIPTION
    ;

</cfquery>



<div id="accordion" style="float: left; width: 320px; height: auto; padding: 5px; font-size: 1em">

	<h3 class="individualnotesaddfolder" id="<cfoutput>#getFolderName.FOLDERCODE#~#getFolderName.FOLDERCODE#~addfolder</cfoutput>"><a  href="##" style="color: #06F">New Folder</a></h3>
    
    	<div style="width: auto; height: auto;"></div>

        <cfloop query="getFolderName">
        
        
          <h3 class="individualfolder" id="<cfoutput>#getFolderName.FOLDERCODE#~#getFolderName.FOLDERCODE#~thefolder</cfoutput>" ><cfoutput>#DESCRIPTION#</cfoutput></h3>
          
          <div style="width: auto; height: auto;">
          
            <cfquery name="getTitleName" datasource="#client.company_dsn#">
        
                SELECT COLLABCODE,
                       FOLDERCODE,
                       SUBJECT
                  FROM ECRGCOLLABTHREAD
                 WHERE FOLDERCODE = '#getFolderName.FOLDERCODE#'
              ORDER BY SUBJECT;
            
            </cfquery> 
            
            
            
            <ul >
                
                <li class="individualnotesadd" id="<cfoutput>#getFolderName.FOLDERCODE#~#getFolderName.FOLDERCODE#~addnote</cfoutput>"><a href="##" style="color: #06F">New Topic</a></li>
            <cfloop query="getTitleName">
                <li><a class="individualnotes" id="<cfoutput>#getTitleName.FOLDERCODE#~#getTitleName.COLLABCODE#~viewnote</cfoutput>" href="##"><cfoutput>#SUBJECT#</cfoutput></a></li>
            </cfloop>
                
            </ul>
                    
                <p><a class="individualnotesshare" id="<cfoutput>#getFolderName.FOLDERCODE#~#getFolderName.FOLDERCODE#~share</cfoutput>" href="##" style="color: #0F6; font-size: .8em">Share</a></p>
                <p><a class="individualnotesdelete" id="<cfoutput>#getFolderName.FOLDERCODE#~#getFolderName.FOLDERCODE#~deletenote</cfoutput>" href="##" style="color: #F00; font-size: .8em">Delete selected topic</a></p>
                <p><a class="individualnotesxfolder" id="<cfoutput>#getFolderName.FOLDERCODE#~#getFolderName.FOLDERCODE#~deletefolder</cfoutput>" href="##" style="color: #F00; font-size: .8em">Delete this folder</a></p>
            
            
          </div>
          
          
         </cfloop>
 
 
 	

 </div> <!---end accordion div--->



    <cfquery name="getContent" datasource="#client.company_dsn#" maxrows="1">

        SELECT A.SUBJECT AS SUBJECT,
        	   A.CONTENT AS CONTENT, 
               A.COLLABCODE AS COLLABCODE,
               A.FOLDERCODE AS FOLDERCODE,
               B.FOLDERCODE AS FOLDERCODEB
         FROM  ECRGCOLLABTHREAD A JOIN ECRGCOLLAB B
               ON A.FOLDERCODE = B.FOLDERCODE
        WHERE  B.USERID = '#client.USERID#'
     ORDER BY  B.DESCRIPTION, A.SUBJECT;
        
       
    </cfquery>   

  <form name="enoteform" method="post">

    <div id="accordion_cont" style="left: 540px;  width: auto; height: auto; padding: 5px; position: absolute;" >
    <textarea name="newNotePageDtl" id="elm3" style="width:auto;height:200px;" >
        <cfoutput>#getContent.CONTENT#</cfoutput>
    </textarea>
    </div>
  </form>


<span style="display: none;" id="current_ids"><cfoutput>#getContent.FOLDERCODE#~#getContent.COLLABCODE#~viewnote</cfoutput></span>
<span style="display: none;" id="current_ids2"><cfoutput>#getContent.FOLDERCODE#~#getContent.COLLABCODE#~viewnote</cfoutput></span>
 


	<div id="dialog" title="Share">
         <p style="font-size: .9em">
        	<select id="selectionid" onchange="sharepeoplechange()"> 
            	<option>Share to:</option>
                <option>Group</option>
                <option>Individual</option>
				<option>Only Me</option>
                <option>Already shared to</option>
            </select>
         </p>
          <div id="containerp" style="width: auto; height: auto; font-size: .9em">      
                <div class="ui-widget" style="font-size: .9em">
                <label for="birds">Search: </label>
                <input style="font-size: .9em" id="birds" />
                </div>
            
            <div class="ui-widget" style="margin-top: 2em; font-family: Arial; font-size: .9em">
                
                <div id="log" style="height: 200px; width: 350px; overflow: auto; font-size: .9em" class="ui-widget-content"></div>
            </div>
            
          </div>
          
          
        
    </div>
    
          
<script type="text/javascript">

	//dialog
	
	
		 $( "#dialog" ).dialog({ 
		 		modal: true, 
				autoOpen: false, 
				height: 'auto', 
				width: 'auto', 
				position: 'top',
				buttons: [ { id: 'okbutton', text: 'Share', click: function() { shareclick(); } } ] 
		  });
		  
		 $( ".individualnotesshare" ).click(function() {  
		 $( "#dialog" ).dialog( "open" );
		  $("#okbutton").button("enable");
		 //$( "#dialog" ).dialog('option', 'title', 'My New title');;
		 });
		 
		 $( "#accordion" ).accordion({ heightStyle: 'content', collapsible: true, active: 1 });
		
		$(function() {
			
			 
			
			function log( message ) {
				$( "<div>" ).text( message ).prependTo( "#log" );
				$( "#log" ).scrollTop( 0 );
			}
	
			$( "#birds" ).autocomplete({
				source: function(request, response) {
					
						var cterm = request.term;
						var inival = new Array();
						var curr_pe = $('#selectionid').val();
						
						var current_collab = $("#current_ids").text();
						var t_arr = new Array();
						t_arr = current_collab.split('~');
						collabcode = t_arr[1];
						
						$.post("../../etasks/applications/egallery/mysource.cfm", { 'argid': cterm, 'peopletype': curr_pe, 'collabcode': collabcode, 'tablename': 'ECRTCOLLAB' })  
						.done(function(data) {
						
						
							var xx = data.toString();
						
								var startposition = xx.indexOf('~trimstartshere2~');
								var startposition = parseInt(startposition);
								var endposition   = xx.indexOf('~trimendshere2~'); 
								var endposition   = parseInt(endposition);	
								
							  
									if (startposition >= 0 && endposition >= 0)
									{
									   var answered = xx.substring(startposition + 17, endposition);
									   //alert(answered);
									    var res_array = new Array();
									   res_array = answered.split(',');
									   
									   $("#okbutton").button("enable");
									   
									   response(res_array);
									   
									}
									else
									{ 
										inival = "Missing delimiter";
										var res_array = new Array();
									    res_array = inival.split(',');
										response(res_array);
										
									}
						
						})
						.fail(function(event, jqxhr, settings, exception) { 
						
							  alert(settings);
							  inival = "Missing delimiter";
								var res_array = new Array();
								res_array = inival.split(',');
								response(res_array);
							  
							  return false;
						
						 });
					
					},
				minLength: 1,
				delay: 500,
				select: function( event, ui ) {
					log( ui.item ?
						ui.item.value:
						"Nothing selected, input was " + this.value );
				}
			});
		});

	
	//end dialog



// O2k7 skin (silver)
	tinyMCE.init({
					// General options
					mode : "exact",
					elements : "elm3",
					theme : "advanced",
					skin : "o2k7",
					skin_variant : "white",
					plugins : "lists,style,table,save,advhr,advlink,contextmenu,directionality",
			
					// Theme options
					theme_advanced_buttons1 : "save,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect, |,forecolor,backcolor",
					theme_advanced_buttons2 : "",
					theme_advanced_buttons3 : "",
					theme_advanced_buttons4 : "",
					theme_advanced_toolbar_location : "top",
					theme_advanced_toolbar_align : "left",
					theme_advanced_statusbar_location : "none",
					theme_advanced_resizing : true,
					//save_callback : 'savenow'
					save_onsavecallback: function() {  savenow();}
		
				});
	

</script>


</body>
</html>
